package com.bean;

import java.util.ArrayList;
import java.util.List;

import com.util.ListUtil;
import com.util.SrcUtil;
import com.util.YLUtil;

public class Main {
	
	public static final int JJ = 20;
	
	public static void main (String argsp[]){
		List <Integer> p1list = new ArrayList <Integer>(); // position 1
		List  <Integer>p2list = new ArrayList <Integer>();
		List <Integer> p3list = new ArrayList <Integer>();
		List <Integer> p4list = new ArrayList <Integer>();
		List  <Integer> p5list = new ArrayList <Integer>();
		
		p1list =  SrcUtil.readFileSingle("src/cqssc.txt",0);
		p2list =  SrcUtil.readFileSingle("src/cqssc.txt",1);
		p3list =  SrcUtil.readFileSingle("src/cqssc.txt",2);
		p4list =  SrcUtil.readFileSingle("src/cqssc.txt",3);
		p5list =  SrcUtil.readFileSingle("src/cqssc.txt",4);
		
		int cost = 0;
		int pro = 0;
		int len = p1list.size();
		for (int i = 20; i < len; i++) {

			int a1 = YLUtil.ylListSort(p1list.subList(i - 20, i - 1), 10)
					.get(9);
			int a2 = YLUtil.ylListSort(p2list.subList(i - 20, i - 1), 10)
					.get(9);
			int a3 = YLUtil.ylListSort(p3list.subList(i - 20, i - 1), 10)
					.get(9);
			int a4 = YLUtil.ylListSort(p4list.subList(i - 20, i - 1), 10)
					.get(9);
			int a5 = YLUtil.ylListSort(p5list.subList(i - 20, i - 1), 10)
					.get(9);
			cost += 2;

			List l = new ArrayList();
			l.add(a1);
			l.add(a2);
			l.add(a3);
			l.add(a4);
			l.add(a5);
			
			int a = ListUtil.getMax(l);
			
			System.out.println(l + "----" + a);
			
			if (a == 0) {
				if (a1 == p1list.get(i).intValue()) {
					pro += JJ;
				}
			}

			if (a == 1) {
				if (a2 == p2list.get(i).intValue()) {
					pro += JJ;
				}
			}
			if (a == 2) {
				if (a3 == p3list.get(i).intValue()) {
					pro += JJ;
				}
			}

			if (a == 3) {
				if (a4 == p4list.get(i).intValue()) {
					pro += JJ;
				}
			}
			if (a == 4) {
				if (a5 == p5list.get(i).intValue()) {
					pro += JJ;
				}
			}

		}
		
		System.out.println(cost +"==" + pro);
		
	}

}
